﻿#ifndef __BORDERPAINTER_H__
#define __BORDERPAINTER_H__

#include "painter.h"
#include "../canvas.h"

class ShapeManager;
enum class GirdPosition
{
	Missing,
	LeftTop,
	LeftMid,
	LeftEnd,
	MainTop,
	MainEnd,
	RightTop,
	RightMid,
	RightEnd,
};


class BorderPainter : public Painter
{
private:
	//拖拽框半边长（使用半边长可以减少算术次数）
	int border_length = 6;
public:
	explicit BorderPainter(QObject* parent);
	virtual void paint(QPainter& painter) override;
	GirdPosition BorderDetect(const QPoint& point) const;
	
};

class SelectPainter : public Painter
{
public:
	explicit SelectPainter(QObject* parent);
	virtual void paint(QPainter& painter) override;
};

class ConnectPainter : public Painter
{
private:
	ShapeManager* shape_manager;
public:
	explicit ConnectPainter(QObject* parent, ShapeManager* manager);
	virtual void paint(QPainter& painter) override;
};


#endif // !__BORDERPAINTER_H__
